package com.qianyu.project.mapper.provider.mfy;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.qianyu.project.entity.MaterialInfo;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;

import java.util.Map;

/**
 * @Author mfy
 * @desc
 */
public class MaterialInfoProvider {

    public String MfyCreatedList(IPage<MaterialInfo> page, Map<String, String> params){
        return new SQL(){
            {
                SELECT("*");
                FROM("material_info");
                if(!StringUtils.isEmpty(params.get("materialName"))){
                    WHERE("material_name like '"+params.get("materialName")+"'");
                }
                if(!StringUtils.isEmpty(params.get("unit"))){
                    WHERE("unit like '%"+params.get("unit")+"%'");
                }
            }
        }.toString();
    }
}
